aboutsummaryrefslogtreecommitdiff
path: root/src/pages/board/[board]/[tid].astro
blob: 4aa34eff009afc8c06e9399792c430bb02a7c0b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
import Default from '../../../layouts/Default.astro';
import Thread from '../../../components/Thread.svelte'
import '../../../styles/thread.css'
import type Thread from '../../../models/Thread';

import { api } from '../../../lib/api';
import { processThreadIn } from '../../../lib/thread';

const { board } = Astro.params;
const data = await api('get', `thread/${board}/${Astro.params.tid}`);

if(data.status === 404) return Astro.redirect('/404');

const thread: Thread = await data.json();
await processThreadIn(board, thread, true);
---

<Default>
  <Thread thread={thread} board={board} comments=true />
</Default>